package com.atguitu.campus.renwendemo.Controller;


import com.atguitu.campus.renwendemo.dto.SparkReqDto;
import com.atguitu.campus.renwendemo.service.SparkService;
import com.atguitu.campus.renwendemo.utils.AjaxResult;
import com.atguitu.campus.renwendemo.utils.MyException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/spark")
public class SparkController {

    @Autowired
    private SparkService sparkService;

    @PostMapping("/send")
    public AjaxResult sendSpark(@RequestBody SparkReqDto dto) throws MyException {

        String reqContent="你现在是一个车载对话模型，请根据对话，做出响应的输出\n" +
                "现在车辆状态：{\n" +
                "空调:关闭\n" +
                "车窗:关闭\n" +
                "}\n" +
                "输入内容：{"+dto.getContent()+"}\n" +
                "输出：{\n" +
                "test1:空调开关状态 1表示打开，0表示关闭\n" +
                "test2:车窗关闭状态 1表示打开，0表示关闭\n" +
                "\n" +
                "}\n";
        String res = sparkService.sendMessage(dto.getRole(),dto.getContent());
        return AjaxResult.success("请求成功",res);
    }
}
